<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
    <script>
        //创建axios实例
        let request = axios.create({
            //设置全局url公共部分
            baseURL:'http://192.168.0.30:3030',
            //超时设置
            timeout:1000,
            headers:{
                token:'123456'
            }
        })


        request.get('/users')
        .then(res=>{
            console.log(res.data);
            
        })
        request.post('/users/gaodead',{keyword:'青岛'})
        .then(res=>{
            console.log(res);
            
        })
//使用axios  api 发起一个post请求
        request({
  method: 'post',
  url: '/users/gaoded',
  data: {
    keyword:'青岛'
  }
})
.then(res=>{
    console.log(res);
    
})
    </script>
</body>
</html>